package com.joven.shelltest.test;

import com.joven.shelltest.utils.ReqDuplicateHelper;

import java.util.StringJoiner;
import java.util.UUID;
import java.util.stream.IntStream;

/**
 * @Author wzj
 * @Date 2023-07-27 08:51
 **/
public class OtherTest3 {
    public static void main(String[] args) {
//        UUID uuid = UUID.randomUUID();
//        System.out.println(uuid);
//        String result = uuid.toString().replaceAll("-","");
//        System.out.println(result);


//        StringJoiner sj = new StringJoiner(",");
//        IntStream.range(1, 10).forEach(i -> sj.add(i + ""));
//        System.out.println(sj.toString());
//        sj.add("joven").add("coco");
//        System.out.println(sj);



        //两个请求一样，但是请求时间差一秒
        String req = "{\n" +
                "\"requestTime\" :\"20190101120001\",\n" +
                "\"requestValue\" :\"1000\",\n" +
                "\"requestKey\" :\"key\"\n" +
                "}";

        String req2 = "{\n" +
                "\"requestTime\" :\"20190101120002\",\n" +
                "\"requestValue\" :\"1000\",\n" +
                "\"requestKey\" :\"key\"\n" +
                "}";

        //全参数比对，所以两个参数MD5不同
        String dedupMD5 = new ReqDuplicateHelper().duplicateParamMD5(req);
        String dedupMD52 = new ReqDuplicateHelper().duplicateParamMD5(req2);
        System.out.println("req1MD5 = "+ dedupMD5+" , req2MD5="+dedupMD52);

        //去除时间参数比对，MD5相同
        String dedupMD53 = new ReqDuplicateHelper().duplicateParamMD5(req,"requestTime");
        String dedupMD54 = new ReqDuplicateHelper().duplicateParamMD5(req2,"requestTime");
        System.out.println("req1MD5 = "+ dedupMD53+" , req2MD5="+dedupMD54);
    }
}
